﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XYAC.Framework.MonitorTireMaterialManual.common
{
    public class Util
    {
        /// <summary>
        /// 值边界检查。
        /// 
        /// </summary>
        /// <param name="value">当前值</param>
        /// <param name="lv">下限值</param>
        /// <param name="hv">上限值</param>
        /// <returns></returns>
        public bool exeCheck(string value, decimal hv, decimal lv)
        {
            if (string.IsNullOrEmpty(value)) return false;
            decimal infactValue;
            if (decimal.TryParse(value, out infactValue))
            {
                //double infactValue = double.Parse(value.Trim());
                if (infactValue < lv || infactValue > hv)
                {
                    return false;
                }
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="hv"></param>
        /// <param name="lv"></param>
        /// <returns></returns>
        public bool exeCheck(double? value, double? hv, double? lv)
        {
            if (value < lv || value > hv)
            {
                return false;
            }
            return true;
        }
        public bool lessCheck(double? value, double? hv)
        {
            if (value > hv)
            {
                return false;
            }
            return true;
        }

        public bool moreCheck(double? value, double? hv)
        {
            if (value < hv)
            {
                return false;
            }
            return true;
        }

    }
}
